package com.zsk.gen;

import org.apache.velocity.VelocityContext;

/**
 * 生成entity
 * 
 * @author keke
 * @date 2020/07/30
 */
public class CommonGen {

    GenConfig config;

    public CommonGen(GenConfig config) {
        super();

        this.config = config;

    }

    public void gen() {

        String packageName = config.getBasePackage();

        packageName += ".bean";

        VelocityContext context = VelocityUtil.createContext();
        context.put("author", config.getAuthor());
        context.put("time", GenUtil.getYmd());
        context.put("package", packageName);

        String vmPath = "com/zsk/template/PageBean.vm";
        String targetPath = "src/main/java/" + packageName.replaceAll("\\.", "/") + "/PageBean.java";
        VelocityUtil.build(vmPath, targetPath, context);

    }

}
